﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PowerApp
{
    public partial class ChannelForm2 : Form
    {
        public ChannelForm2()
        {
            InitializeComponent();
        }

        protected override void OnLoad(EventArgs e)
        {
            listBox1.ClearSelected();

            base.OnLoad(e);
        }

        private void selectallbutton3_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < listBox1.Items.Count; i++)
            {
                listBox1.SelectedIndices.Add(i);
            }

        }

        private void okbutton1_Click(object sender, EventArgs e)
        {

        }

        public bool [] SelectedChannels
        {
            get
            {
                bool[] selectArray = new bool[listBox1.Items.Count];

                for (int i = 0; i < listBox1.Items.Count; i++)
                {
                    selectArray[i] = listBox1.GetSelected(i);
                }

                return selectArray;
            }
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if(listBox1.SelectedIndices != null && listBox1.SelectedIndices.Count > 0)
            {
                okbutton1.Enabled = true;
            }
            else
            {
                okbutton1.Enabled = false;
            }
        }
    }
}
